﻿namespace Ops.Host.App.ViewModels;

public sealed class EnergyConsumeViewModel : AsyncSinglePagedViewModelBase<DvEnergyConsume, EnergyConsumeFilter>, IViewModel
{
    private readonly IDvEnergyConsumeService _energyConsumptionService;

    public EnergyConsumeViewModel(IDvEnergyConsumeService energyConsumptionService)
    {
        _energyConsumptionService = energyConsumptionService;
    }

    protected override void OnExcelModelCreating(ExcelModelBuilder builder)
    {
        builder.ExcelName = "能耗记录";
        builder.HasExcelNameDatePostfix = true;
    }

    protected override async Task<PagedList<DvEnergyConsume>> OnSearchAsync(int pageIndex, int pageSize)
    {
        return await _energyConsumptionService.GetPagedListAsync(QueryFilter, pageIndex, pageSize);
    }
}
